function [signal_normalized OBO] = WiSiL_Tx_powerNormalization(signal_in,signal_out) 

%powerNormalization normalizes the amplified signal power before
%transmission.
%  After non linear amplification, the signal power is attenuated, but it
%  needs to be maintained in the same level power that it was generetade in
%  order to preserve the symbol decision bounds. In a real system, this
%  normalization is represented by a gain in the receiver.
%
% Syntax:
%  signal_normalized = powerNormalization(signal_in,signal_out)
%  INPUT:
%   signal_in is the input signal of the amplifier
%   signal_out is the outuput signal of the amplifier
%
%  OUTPUT:
%   PowerNormalized is the signal with normalized power

% Ian Alves Ulian, 26/10/2010 Created

 avgPowerIn = mean(abs(signal_in).*abs(signal_in));
 avgPowerOut = mean(abs(signal_out).*abs(signal_out));
 OBO = 10 * log10(1/avgPowerOut);
 normFactor = avgPowerOut/avgPowerIn;
 signal_normalized = signal_out/sqrt(normFactor);
 
 
